package com.demo.sharelucas.模式匹配;

import com.demo.sharelucas.sealeds.Circle;
import com.demo.sharelucas.sealeds.Shape;

/**
 * @Author yaodong
 * @Date 2024/9/17 16:48
 * @Version 1.0
 */
public class Main {
    public static void main(String[] args) {
        Shape shape = new Circle(1);
        if(shape instanceof Circle s){
            s.getName();
        }
        if(shape instanceof Circle){
            ((Circle) shape).getName();
        }
    }
}
